<%@ page import="com.rsscollector.model.RssSourceFacade" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title>RSS List</title>

<script type="text/javascript">
    dojo.require("dojo.widget.FilteringTable");
    dojo.hostenv.writeIncludes();
</script>
</head>

<body>

<div class="pageheading">RSS Sources</div>
&nbsp;

<table dojoType="filteringTable" id="sourceTable"
       multiple="false" alternateRows="true" maxSortable="2"
       cellpadding="0" cellspacing="0" border="0" class="filteringTable">
    <thead>
        <tr>
            <th field="Url" dataType="String" valign="top">URL</th>
            <th field="LastUpdate" dataType="Date" sort="desc" format="%Y-%m-%d %H:%M:%S" align="center" valign="top">
                Last Update
            </th>
            <th dataType="String">Provider</th>
        </tr>
    </thead>
    <tbody>
        <c:forEach var="rssSource" items='<%=RssSourceFacade.listRssSources(true)%>'>
            <tr value="${rssSource.id}">
                <td>
                    <c:out escapeXml="true" value="${rssSource.rssUrl}"/>
                </td>
                <td>
                    <fmt:formatDate value="${rssSource.lastUpdate}" type="both" dateStyle="full" timeStyle="full"/>
                </td>
                <td>
                    <c:out escapeXml="true" value="${rssSource.rssProvider.name}"/>
                </td>
            </tr>
        </c:forEach>
    </tbody>
</table>

<br/>
<button dojoType="Button" widgetId="addSource">Add</button>


</body>
</html>